
#ifndef _BO_H
#define _BO_H
#include <tchar.h>
#include <stdint.h>
#ifndef __cplusplus
#include <stdbool.h>
#else
#define _Bool bool
#endif
#ifndef BOINT
#define BOINT int
#endif
#ifndef BOFLOAT
#define BOFLOAT double
#endif
#ifndef BO_DATALEN
#define BO_DATALEN 20
#endif
#ifndef _BOAPI
#define _BOAPI 
#endif

enum _BoTypeIds {
    BT_NONE, BT_INT, BT_FLOAT, BT_STR
};

/*
typedef struct
{
    TCHAR *sp;
    __strlist *next;
}__strlist;

typedef struct
{
    __strlist *ptr;
    int len;
}strlist;

strlist Bo_MakeStrlist();
void BO_PushStr(strlist *self, TCHAR *str);
int BO_SeekStr(strlist *self, TCHAR *str);
TCHAR *BO_FindStr(strlist *self, int index);
int BO_CountStr(strlist *self, TCHAR *str);
errno_t BO_FreeStr(strlist *self);
*/

typedef struct
{
    int8_t type;
    union
    {
        BOINT i;
        BOFLOAT f;
        TCHAR *s; // str index
    };
}bo_datum;

//void set_datum(bo_datum *self, bo_datum *obj);

bo_datum BO_NULL = {BT_NONE, 0};
_BOAPI _Bool bo_equal(bo_datum *self, bo_datum *obj);

typedef struct BO_DATA
{
    bo_datum dat[BO_DATALEN];
    struct BO_DATA *next;
}BO_DATA;

typedef struct __BasicObject
{
    BO_DATA data;
    int num; // num of DATAs
    int ind; // index of latest datablock
}BOBJECT;

_BOAPI BOBJECT       CreateObject  ();
_BOAPI void          BO_PushInt    (BOBJECT *self, BOINT i);
_BOAPI void          BO_PushFloat  (BOBJECT *self, BOFLOAT f);
_BOAPI void          BO_PushString (BOBJECT *self, TCHAR *s);
_BOAPI bo_datum      BO_FindDatum  (BOBJECT *self, int index);
_BOAPI bo_datum*     BO_GetDatum   (BOBJECT *self, int index);
_BOAPI int           BO_SeekDatum  (BOBJECT *self, bo_datum *dat);
_BOAPI errno_t       BO_FreeObject (BOBJECT *self);

#ifndef _BO_C
#include ".\BasicObjects.c"
#endif
#endif